<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-preview-main">
      <!--      <div class="JNPF-common-page-header">
              <p>中小企业数字化转型测评_其他</p>
              <div class="options">
                <el-button type="primary" @click="dataFormSubmit()"> 保 存</el-button>
                <el-button @click="clearData">重置</el-button>
              </div>
            </div>-->
      <el-row :gutter="60" class=" main" :style="{ margin: '0 auto', width: '100%' }">
        <el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="top">
          <template v-if="!loading">
            <!-- 具体表单 -->
            <el-col :span="4"></el-col>
            <el-col :span="16">
              <div class="tit_top">其他行业中小企业数字化水平评测表（2022年版）</div>
              <div class="tit_sec">
                SELF ASSESSMENT QUESTIONNAIRE OF DIGITAL TRANSFORMATION LEVEL OF SMALL AND
                MEDIUM-SIZED ENTERPRISES
              </div>
              <div class="tit_thr">
                <div class="tit_red"></div>
                <div class="tit_gray"></div>
              </div>
              <div class="met_list">
                <div>总题数：18</div>
                <div>已选：{{ filledFieldsCount - 3 }}</div>
                <div>未选：{{ 21 - filledFieldsCount }}</div>
              </div>
              <div class="steps">
                <el-steps :active="active">
                  <el-step title="数字化基础"></el-step>
                  <el-step title="数字化经营"></el-step>
                  <el-step title="数字化管理"></el-step>
                  <el-step title="数字化成效"></el-step>
                </el-steps>
              </div>
              <div v-show="active == 1" class="steps_con">
                <el-col :span="24">
                  <jnpf-form-tip-item label="1.企业通过部署工业互联网公有云/私有云/混合云平台等形式，实现业务的数字化管理情况" prop="questiontitle1">
                    <JnpfRadio v-model="dataForm.questiontitle1" @change="changeData('questiontitle1', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle1Options"
                      :props="questiontitle1Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="2.企业实现各类数据汇聚及应用的情况(多选)" prop="questiontitle2">
                    <JnpfCheckbox v-model="dataForm.questiontitle2" @change="changeData('questiontitle2', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle2Options"
                      :props="questiontitle2Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="3.企业在保障网络安全方面采取的举措" prop="questiontitle3">
                    <JnpfRadio v-model="dataForm.questiontitle3" @change="changeData('questiontitle3', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle3Options"
                      :props="questiontitle3Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                </el-col>
              </div>
              <div v-show="active == 2" class="steps_con">
                <el-col :span="24">
                  <jnpf-form-tip-item label="4.企业的生产服务流程中是否涉及研发设计场景" prop="questiontitle4">
                    <JnpfRadio v-model="dataForm.questiontitle4" @change="changeData('questiontitle4', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle4Options"
                      :props="questiontitle4Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="5.企业开展数字化研发设计的情况(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle5">
                    <JnpfCheckbox v-model="dataForm.questiontitle5" @change="changeData('questiontitle5', -1)"
                      :disabled="dataForm.questiontitle4 === '是' ? false : true" optionType="default"
                      direction="horizontal" size="small" :options="questiontitle5Options" :props="questiontitle5Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="6.企业的生产服务流程中是否涉及仓储物流场景" prop="questiontitle6">
                    <JnpfRadio v-model="dataForm.questiontitle6" @change="changeData('questiontitle6', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle6Options"
                      :props="questiontitle6Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="7.企业仓储物流数字化场景的覆盖范围(多选)" prop="questiontitle7">
                    <JnpfCheckbox v-model="dataForm.questiontitle7" @change="changeData('questiontitle7', -1)"
                      :disabled="dataForm.questiontitle6 === '是' ? false : true" optionType="default"
                      direction="horizontal" size="small" :options="questiontitle7Options" :props="questiontitle7Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="8.企业实现业务流程数字化场景的覆盖范围(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle8">
                    <JnpfCheckbox v-model="dataForm.questiontitle8" @change="changeData('questiontitle8', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle8Options"
                      :props="questiontitle8Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="9.企业实现运营管理数字化场景的覆盖范围(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle9">
                    <JnpfCheckbox v-model="dataForm.questiontitle9" @change="changeData('questiontitle9', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle9Options"
                      :props="questiontitle9Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="10.新一代信息技术在企业产品服务中的应用情况(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle10">
                    <JnpfCheckbox v-model="dataForm.questiontitle10" @change="changeData('questiontitle10', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle10Options"
                      :props="questiontitle10Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="11.企业实现市场营销数字化场景的覆盖范围(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle11">
                    <JnpfCheckbox v-model="dataForm.questiontitle11" @change="changeData('questiontitle11', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle11Options"
                      :props="questiontitle11Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="12.企业实现售后服务质量管理数字化场景的覆盖范围(多选)" tipLabel="50%以上关键业务研发设计项目实现下列数字化场景即可勾选该项"
                    prop="questiontitle12">
                    <JnpfCheckbox v-model="dataForm.questiontitle12" @change="changeData('questiontitle12', -1)"
                      optionType="default" direction="horizontal" size="small" :options="questiontitle12Options"
                      :props="questiontitle12Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
              </div>
              <div v-show="active == 3" class="steps_con">
                <el-col :span="24">
                  <jnpf-form-tip-item label="13.企业数字化转型意识与执行水平情况(多选)" prop="questiontitle13">
                    <JnpfCheckbox v-model="dataForm.questiontitle13" @change="changeData('questiontitle13', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle13Options"
                      :props="questiontitle13Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="14.企业在设置数字化组织与管理制度等方面采取的措施(多选)" prop="questiontitle14">
                    <JnpfCheckbox v-model="dataForm.questiontitle14" @change="changeData('questiontitle14', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle14Options"
                      :props="questiontitle14Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="15.企业在数字化方面培训覆盖的人员范围(多选)" prop="questiontitle15">
                    <JnpfCheckbox v-model="dataForm.questiontitle15" @change="changeData('questiontitle15', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle15Options"
                      :props="questiontitle15Props">
                    </JnpfCheckbox>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="16.上一年企业的数字化投入占营业收入的比重" prop="questiontitle16">
                    <JnpfRadio v-model="dataForm.questiontitle16" @change="changeData('questiontitle16', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle16Options"
                      :props="questiontitle16Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                </el-col>
              </div>
              <div v-show="active == 4" class="steps_con">
                <el-col :span="24">
                  <jnpf-form-tip-item label="17.企业上年度人均营业收入" prop="questiontitle17">
                    <JnpfRadio v-model="dataForm.questiontitle17" @change="changeData('questiontitle17', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle17Options"
                      :props="questiontitle17Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                  <jnpf-form-tip-item label-width="0" prop="questiontitle17value">
                    <JnpfInputNumber v-model="dataForm.questiontitle17value"
                      @change="changeData('questiontitle17value', -1)" placeholder="请输入具体数值" :step="1" :controls="false"
                                     addonAfter="元"  style="width: 300px;">
                    </JnpfInputNumber>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="18.企业上年度每百元营业收入中的成本" prop="questiontitle18">
                    <JnpfRadio v-model="dataForm.questiontitle18" @change="changeData('questiontitle18', -1)"
                      optionType="default" direction="vertical" size="small" :options="questiontitle18Options"
                      :props="questiontitle18Props">
                    </JnpfRadio>
                  </jnpf-form-tip-item>
                  <jnpf-form-tip-item label-width="0" prop="questiontitle18value">
                    <JnpfInputNumber v-model="dataForm.questiontitle18value"
                      @change="changeData('questiontitle18value', -1)" placeholder="请输入具体数值" :step="1" :controls="false"
                                     addonAfter="元"  style="width: 300px;">
                    </JnpfInputNumber>
                  </jnpf-form-tip-item>
                </el-col>
              </div>
              <div class="footer-button">
                <el-button @click="prev" :disabled="active == 1">上一步</el-button>
                <el-button @click="next" v-if="active < 4" type="primary" :loading="btnLoading" :disabled="active == 4">
                  下一步
                </el-button>
                <el-button type="primary" @click="dataFormSubmit()" v-if="active == 4"> 保存并提交</el-button>
              </div>
            </el-col>
            <el-col :span="4"></el-col>
            <!-- 表单结束 -->
          </template>
        </el-form>
        <SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
          @select="addForSelect" @close="selectDialogVisible = false" />
      </el-row>
    </div>
  </div>
</template>


<script>
import request from '@/utils/request'
import request2 from '@/utils/request2'
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import {
  getDateDay,
  getLaterData,
  getBeforeData,
  getBeforeTime,
  getLaterTime
} from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"

export default {
  components: {},
  props: [],
  data() {
    return {
      filledFieldsCount: 3,
      active: 1,
      dataFormSubmitType: 0,
      continueBtnLoading: false,
      index: 0,
      prevDis: false,
      nextDis: false,
      allList: [],
      visible: false,
      loading: false,
      btnLoading: false,
      formRef: 'formRef',
      setting: {},
      eventType: '',
      userBoxVisible: false,
      selectDialogVisible: false,
      currTableConf: {},
      dataValueAll: {},
      addTableConf: {},
      //可选范围默认值
      ableAll: {},
      tableRows: {},
      Vmodel: "",
      currVmodel: "",
      dataForm: {
        questiontitle1: undefined,
        questiontitle2: [],
        questiontitle3: [],
        questiontitle4: undefined,
        questiontitle5: [],
        questiontitle6: undefined,
        questiontitle7: [],
        questiontitle8: [],
        questiontitle9: [],
        questiontitle10: [],
        questiontitle11: [],
        questiontitle12: [],
        questiontitle13: [],
        questiontitle14: [],
        questiontitle15: [],
        questiontitle16: undefined,
        questiontitle17: undefined,
        questiontitle18: undefined,
        questiontitle17value: undefined,
        questiontitle18value: undefined,
        F_Company_Name: this.$route.query.companyName,
        F_Creedit_Code: this.$route.query.creeditCode,
        F_Company_Id: this.$route.query.companyId
      },
      tableRequiredData: {},
      activedqdhrd: '6TZMSu1',
      dataRule:
      {
        questiontitle1: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
        questiontitle2: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle3: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle4: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
        questiontitle6: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
        questiontitle8: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle9: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle10: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle11: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle12: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle13: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle14: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle15: [
          {
            required: true,
            message: '请至少选择一个',
            trigger: 'change'
          },
        ],
        questiontitle16: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
        questiontitle17: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
        questiontitle18: [
          {
            required: true,
            message: '不能为空',
            trigger: 'change'
          },
        ],
      },
      questiontitle1Options: [],
      questiontitle1Props: { "label": "fullName", "value": "fullName" },
      questiontitle2Options: [],
      questiontitle2Props: { "label": "fullName", "value": "fullName" },
      questiontitle3Options: [],
      questiontitle3Props: { "label": "fullName", "value": "fullName" },
      questiontitle4Options: [],
      questiontitle4Props: { "label": "fullName", "value": "fullName" },
      questiontitle5Options: [],
      questiontitle5Props: { "label": "fullName", "value": "fullName" },
      questiontitle6Options: [],
      questiontitle6Props: { "label": "fullName", "value": "fullName" },
      questiontitle7Options: [],
      questiontitle7Props: { "label": "fullName", "value": "fullName" },
      questiontitle8Options: [],
      questiontitle8Props: { "label": "fullName", "value": "fullName" },
      questiontitle9Options: [],
      questiontitle9Props: { "label": "fullName", "value": "fullName" },
      questiontitle10Options: [],
      questiontitle10Props: { "label": "fullName", "value": "fullName" },
      questiontitle11Options: [],
      questiontitle11Props: { "label": "fullName", "value": "fullName" },
      questiontitle12Options: [],
      questiontitle12Props: { "label": "fullName", "value": "fullName" },
      questiontitle13Options: [],
      questiontitle13Props: { "label": "fullName", "value": "fullName" },
      questiontitle14Options: [],
      questiontitle14Props: { "label": "fullName", "value": "fullName" },
      questiontitle15Options: [],
      questiontitle15Props: { "label": "fullName", "value": "fullName" },
      questiontitle16Options: [],
      questiontitle16Props: { "label": "fullName", "value": "fullName" },
      questiontitle17Options: [],
      questiontitle17Props: { "label": "fullName", "value": "fullName" },
      questiontitle18Options: [],
      questiontitle18Props: { "label": "fullName", "value": "fullName" },
      childIndex: -1,
      isEdit: false,
      interfaceRes: {
        questiontitle1: [],
        questiontitle2: [],
        questiontitle3: [],
        questiontitle4: [],
        questiontitle5: [],
        questiontitle6: [],
        questiontitle7: [],
        questiontitle8: [],
        questiontitle9: [],
        questiontitle10: [],
        questiontitle11: [],
        questiontitle12: [],
        questiontitle13: [],
        questiontitle14: [],
        questiontitle15: [],
        questiontitle16: [],
        questiontitle17: [],
        questiontitle17value: [],
        questiontitle18: [],
        questiontitle18value: [],
      },
    }
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  watch: {
    dataForm: {
      handler(newVal, oldVal) {
        // 遍历dataForm对象的属性
        this.filledFieldsCount = Object.keys(newVal).reduce((count, key) => {
          // 检查字段是否有值，排除空数组
          if (newVal[key] !== null && newVal[key] !== undefined && typeof newVal[key] !== 'number') {
            // 如果字段值是数组，检查其长度；如果长度为0，则不增加计数
            if (Array.isArray(newVal[key]) && newVal[key].length === 0) {
              return count;
            }
            // 如果字段值不是数组，或者数组长度大于0，则增加计数
            return count + 1;
          }
          return count;
        }, 0);
      },
      deep: true  // 深度监听对象的变化
    }
  },
  created() {
    this.dataAll()
    this.initDefaultData()
    this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
  },
  mounted() {
  },
  methods: {
    prev() {
      this.active--
      const formElement = this.$refs.formRef;
      // 滚动到表单元素的顶部
      formElement.$el.scrollIntoView({ behavior: 'smooth', block: 'center' });
    },
    next() {
      this.active++
      const formElement = this.$refs.formRef;
      // 滚动到表单元素的顶部
      formElement.$el.scrollIntoView({ behavior: 'smooth', block: 'center' });
    },
    getInfo(id) {
      request({
        url: '/api/example/Fz_digital_transformation_evaluation_others/' + id,
        method: 'get'
      }).then(res => {
        this.dataInfo(res.data)
      });
    },
    goBack() {
      this.visible = false
      this.$emit('refreshDataList', true)
    },
    changeData(model, index) {
      this.isEdit = false
      this.childIndex = index
      let modelAll = model.split("-");
      let faceMode = "";
      for (let i = 0; i < modelAll.length; i++) {
        faceMode += modelAll[i];
      }
      for (let key in this.interfaceRes) {
        if (key != faceMode) {
          let faceReList = this.interfaceRes[key]
          for (let i = 0; i < faceReList.length; i++) {
            if (faceReList[i].relationField == model) {
              let options = 'get' + key + 'Options';
              if (this[options]) {
                this[options]()
              }
              this.changeData(key, index)
            }
          }
        }
      }
    },
    changeDataFormData(type, data, model, index, defaultValue) {
      if (!this.isEdit) {
        if (type == 2) {
          for (let i = 0; i < this.dataForm[data].length; i++) {
            if (index == -1) {
              this.dataForm[data][i][model] = defaultValue
            } else if (index == i) {
              this.dataForm[data][i][model] = defaultValue
            }
          }
        } else {
          this.dataForm[data] = defaultValue
        }
      }
    },
    dataAll() {
      this.getquestiontitle1Options();
      this.getquestiontitle2Options();
      this.getquestiontitle3Options();
      this.getquestiontitle4Options();
      this.getquestiontitle5Options();
      this.getquestiontitle6Options();
      this.getquestiontitle7Options();
      this.getquestiontitle8Options();
      this.getquestiontitle9Options();
      this.getquestiontitle10Options();
      this.getquestiontitle11Options();
      this.getquestiontitle12Options();
      this.getquestiontitle13Options();
      this.getquestiontitle14Options();
      this.getquestiontitle15Options();
      this.getquestiontitle16Options();
      this.getquestiontitle17Options();
      this.getquestiontitle18Options();
    },
    getquestiontitle1Options() {
      getDictionaryDataSelector('514055896687444037').then(res => {
        this.questiontitle1Options = res.data.list
      })
    },
    getquestiontitle2Options() {
      getDictionaryDataSelector('514056480937214021').then(res => {
        this.questiontitle2Options = res.data.list
      })
    },
    getquestiontitle3Options() {
      getDictionaryDataSelector('514056847162867781').then(res => {
        this.questiontitle3Options = res.data.list
      })
    },
    getquestiontitle4Options() {
      getDictionaryDataSelector('514057412739596357').then(res => {
        this.questiontitle4Options = res.data.list
      })
    },
    getquestiontitle5Options() {
      getDictionaryDataSelector('514057507572809797').then(res => {
        this.questiontitle5Options = res.data.list
      })
    },
    getquestiontitle6Options() {
      getDictionaryDataSelector('514057612346523717').then(res => {
        this.questiontitle6Options = res.data.list
      })
    },
    getquestiontitle7Options() {
      getDictionaryDataSelector('514057769544843333').then(res => {
        this.questiontitle7Options = res.data.list
      })
    },
    getquestiontitle8Options() {
      getDictionaryDataSelector('514057817112444997').then(res => {
        this.questiontitle8Options = res.data.list
      })
    },
    getquestiontitle9Options() {
      getDictionaryDataSelector('514057866684923973').then(res => {
        this.questiontitle9Options = res.data.list
      })
    },
    getquestiontitle10Options() {
      getDictionaryDataSelector('514057917691854917').then(res => {
        this.questiontitle10Options = res.data.list
      })
    },
    getquestiontitle11Options() {
      getDictionaryDataSelector('514057973438349381').then(res => {
        this.questiontitle11Options = res.data.list
      })
    },
    getquestiontitle12Options() {
      getDictionaryDataSelector('514083618465775685').then(res => {
        this.questiontitle12Options = res.data.list
      })
    },
    getquestiontitle13Options() {
      getDictionaryDataSelector('514083720030847045').then(res => {
        this.questiontitle13Options = res.data.list
      })
    },
    getquestiontitle14Options() {
      getDictionaryDataSelector('514083786447650885').then(res => {
        this.questiontitle14Options = res.data.list
      })
    },
    getquestiontitle15Options() {
      getDictionaryDataSelector('514083897529598021').then(res => {
        this.questiontitle15Options = res.data.list
      })
    },
    getquestiontitle16Options() {
      getDictionaryDataSelector('514083969373831237').then(res => {
        this.questiontitle16Options = res.data.list
      })
    },
    getquestiontitle17Options() {
      getDictionaryDataSelector('514084066392277061').then(res => {
        this.questiontitle17Options = res.data.list
      })
    },
    getquestiontitle18Options() {
      getDictionaryDataSelector('514086524287975493').then(res => {
        this.questiontitle18Options = res.data.list
      })
    },
    clearData() {
      this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
    },
    init(id, isDetail, allList) {
      this.prevDis = false
      this.nextDis = false
      this.allList = allList || []
      if (allList.length) {
        this.index = this.allList.findIndex(item => item.id === id)
        if (this.index == 0) {
          this.prevDis = true
        }
        if (this.index == this.allList.length - 1) {
          this.nextDis = true
        }
      } else {
        this.prevDis = true
        this.nextDis = true
      }
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/Fz_digital_transformation_evaluation_others/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          });
        } else {
          this.clearData()
          this.initDefaultData()
        }
      });
      this.$store.commit('generator/UPDATE_RELATION_DATA', {})
    },
    //初始化默认数据
    initDefaultData() {

    },
    // 表单提交
    dataFormSubmit(type) {
      this.dataFormSubmitType = type ? type : 0
      this.$refs['formRef'].validate((valid) => {
        if (valid) {
          this.request()
        }
      })

    },
    request2(F_Id) {
      let _data = this.dataList()
      _data.F_Id = F_Id
      request2({
        url: '/fzzxqy/outEvaluate_others',
        method: 'post',
        data: _data
      }).then((res) => {
        this.$message({
          message: res.msg,
          type: 'success',
          duration: 1000,
          onClose: () => {
            this.clearData()
            this.initDefaultData()
            // 在当前组件中进行页面跳转并传递参数
            this.$router.push({
              path: '/outDigitalLevel',
              query: {
                companyName: this.$route.query.companyName,
                creeditCode: this.$route.query.creeditCode
              }
            });
          }
        })
      }).catch(() => {
        this.btnLoading = false
        this.continueBtnLoading = false
      })
    },
    request() {
      let _data = this.dataList()
      if (this.dataFormSubmitType == 2) {
        this.continueBtnLoading = true
      } else {
        this.btnLoading = true
      }
      if (!this.dataForm.id) {
        request({
          url: '/api/example/Fz_digital_transformation_evaluation_others',
          method: 'post',
          data: _data
        }).then((res) => {
          this.request2(res.data.id)
          // this.$message({
          //     message: res.msg,
          //     type: 'success',
          //     duration: 1000,
          //     onClose: () => {
          //         this.clearData()
          //         this.initDefaultData()
          //     }
          // })
        }).catch(() => {
          this.btnLoading = false
          this.continueBtnLoading = false
        })
      } else {
        request({
          url: '/api/example/Fz_digital_transformation_evaluation_others/' + this.dataForm.id,
          method: 'PUT',
          data: _data
        }).then((res) => {
          this.$message({
            message: res.msg,
            type: 'success',
            duration: 1000,
            onClose: () => {
              if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
              this.visible = false
              this.btnLoading = false
              this.$emit('refresh', true)
            }
          })
        }).catch(() => {
          this.btnLoading = false
          this.continueBtnLoading = false
        })
      }
    },
    openSelectDialog(key) {
      this.currTableConf = this.addTableConf[key]
      this.currVmodel = key
      this.selectDialogVisible = true
      this.$nextTick(() => {
        this.$refs.selectDialog.init()
      })
    },
    addForSelect(data) {
      for (let i = 0; i < data.length; i++) {
        let t = data[i]
        if (this['get' + this.currVmodel]) {
          this['get' + this.currVmodel](t)
        }
      }
    },
    dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
      let timeDataValue = null;
      let timeValue = Number(timeValueData)
      if (timeRule) {
        if (timeType == 1) {
          timeDataValue = timeValue
        } else if (timeType == 2) {
          timeDataValue = dataValue
        } else if (timeType == 3) {
          timeDataValue = new Date().getTime()
        } else if (timeType == 4) {
          let previousDate = '';
          if (timeTarget == 1 || timeTarget == 2) {
            previousDate = getDateDay(timeTarget, timeType, timeValue)
            timeDataValue = new Date(previousDate).getTime()
          } else if (timeTarget == 3) {
            previousDate = getBeforeData(timeValue)
            timeDataValue = new Date(previousDate).getTime()
          } else {
            timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
          }
        } else if (timeType == 5) {
          let previousDate = '';
          if (timeTarget == 1 || timeTarget == 2) {
            previousDate = getDateDay(timeTarget, timeType, timeValue)
            timeDataValue = new Date(previousDate).getTime()
          } else if (timeTarget == 3) {
            previousDate = getLaterData(timeValue)
            timeDataValue = new Date(previousDate).getTime()
          } else {
            timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
          }
        }
      }
      return timeDataValue;
    },
    time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
      let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
      let timeDataValue = null
      if (timeRule) {
        if (timeType == 1) {
          timeDataValue = timeValue || '00:00:00'
          if (timeDataValue.split(':').length == 3) {
            timeDataValue = timeDataValue
          } else {
            timeDataValue = timeDataValue + ':00'
          }
        } else if (timeType == 2) {
          timeDataValue = dataValue
        } else if (timeType == 3) {
          timeDataValue = this.jnpf.toDate(new Date(), format)
        } else if (timeType == 4) {
          let previousDate = '';
          previousDate = getBeforeTime(timeTarget, timeValue)
          timeDataValue = this.jnpf.toDate(previousDate, format)
        } else if (timeType == 5) {
          let previousDate = '';
          previousDate = getLaterTime(timeTarget, timeValue)
          timeDataValue = this.jnpf.toDate(previousDate, format)
        }
      }
      return timeDataValue;
    },
    dataList() {
      var _data = this.dataForm;
      return _data;
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      this.dataForm = _dataAll
      this.isEdit = true
      this.dataAll()
      this.childIndex = -1
    },
  },
}

</script>
<style lang="scss" scoped>
.el-col {
  padding: 10px 20px;
}

.main {
  .tit_top {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: #333;
    margin-top: 20px;
  }

  .tit_sec {
    font-weight: 400;
    text-align: center;
    font-size: 12px;
    color: #ccc;
    margin-top: 6px;
    margin-bottom: 15px;
  }

  .tit_thr {
    width: 200px;
    height: 2px;
    margin: 10px auto;
    display: flex;

    .tit_red {
      width: 100px;
      height: 3px;
      background-color: #1890FF;
    }

    .tit_gray {
      width: 100px;
      height: 3px;
      background-color: #1890FF;
    }
  }

  .met_list {
    display: flex;
    margin: 20px auto;
    text-align: center;

    div {
      margin: auto;
      width: 100px;
    }
  }

  .steps {
    padding: 10px 80px;

    ::v-deep .el-step__main .is-finish {
      font-weight: bold;
    }
  }

  .steps_con {
    .el-col {
      border-bottom: 1px dotted grey;
    }
  }

  .footer-button {
    margin: auto;
    text-align: center;
    width: 100%;

    .el-button {
      margin: 20px;
      width: 150px;
    }
  }
}
</style>
